import request from '../util/request2'

const baseUrl = process.env.NODE_ENV === 'production' ? '' : '/cycleMap'

export function chargers() {
  return request({
    url:baseUrl+ "/lcebcharger",
    method: "get",
    params: {
      
    }
  })
}

export function loadChargersApi(params) {
  return request({
    url:baseUrl+ "/lcebcharger/listLcEbChargerAll",
    method: "get",
    params: params
  })
}

export function loadChargersListApi(params) {
  return request({
    url:baseUrl+ "/lcebcharger/list",
    method: "get",
    params: params
  })
}

export function addApi(form) {
  return request({
    url:baseUrl+ "/lcebcharger",
    method: "post",
    data: form
  });
}

export function batchDelApi(multipleSelection) {
  let ids = new Array();
  for (let i = 0; i < multipleSelection.length; i++) {
    ids[i] = multipleSelection[i].id
  }
  return request({
    url:baseUrl+ '/lcebcharger',
    method: 'delete',
    data: ids
  });
}

export function delEBChargerApi(row){
  return request({
    url:baseUrl+"/lcebcharger/selective",
    method:"delete",
    data:{
      id : row.id
    }
  })
}

export function setPriceApi(row) {
  return request({
    url:baseUrl+ '/lcSet/priceSet?deviceNo='+row.mac,
    method: 'get',
  });
}

export function getPriceApi(row) {
  return request({
    url:baseUrl+ '/lcSet/priceQuery?deviceNo='+row.mac,
    method: 'get',
  });
}

export function getByMac(row) {
  return request({
    url:baseUrl+ '/lcebcharger/getByMac?mac='+row.mac,
    method: 'get',
  });
}

export function plugSet(deviceNo, id, workType) {
  return request({
    url:baseUrl+ '/lcSet/plugSet?deviceNo='+deviceNo+'&plugNo='+id+'&workType='+workType,
    method: 'get',
  });
}